package com.zoo.diannaopeijian.service.impl;

import com.zoo.diannaopeijian.comm.page.Page;
import com.zoo.diannaopeijian.comm.sql.GeneratorExampleBuilder;
import com.zoo.diannaopeijian.domain.Entryrecord;
import com.zoo.diannaopeijian.domain.EntryrecordExample;
import com.zoo.diannaopeijian.mapper.EntryrecordMapper;
import com.zoo.diannaopeijian.service.EntryrecordService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * Created by zx583 on 2018-01-27.
 */
@Service
public class EntryrecordServiceImpl implements EntryrecordService {
    @Resource
    private EntryrecordMapper entryrecordMapper;

    @Override
    public boolean insertEntryRecord(Entryrecord entryrecord) {
        return entryrecordMapper.insertSelective(entryrecord) == 1;
    }

    @Override
    public List<Map> getEntryRecord(Date from, Date to, String staffname) {
        return entryrecordMapper.getEntryRecord(from, to, staffname);
    }

    @Override
    public List<Map> getEntryRecordWithPage(Date from, Date to, String staffname, Page page) {
        if (page != null) {
            page.onPage();
        }

        return getEntryRecord(from, to, staffname);
    }
}
